from odoo import fields, models, _
from odoo.exceptions import UserError


class StockMoveLine(models.Model):
    _inherit = 'stock.move.line'

    s_production_id = fields.Many2one('mrp.production', string='Production', copy=False, readonly=True)

    def _action_done(self):
        if self.env['ir.config_parameter'].sudo().get_param('pcb.s_during_the_inventory_period'):
            raise UserError(_('During the system inventory period, transfer and posting are not allowed!'))
        return super()._action_done()